import { request }  from '@/axios/request'

//获取银行编码

export const CreateCode = () => {
    return request({
        url: '/CreditContract/CreateCode',
        method: 'get'
    })
}

//单个获取
export const GetOne = (parmas) => {
    return request({
        url: '/CreditContract/Get',
        method: 'get',
        data: {"Id": parmas}
    })
}

// 列表查询接口
export const GetList = (parmas) => {
    return request({
        url: '/CreditContract/EntityList',
        method: 'get',
        data: parmas
    });
}
//分页查询
export const GetListByPage = (parmas) => {
    return request({
        url: '/CreditContract/ListByPage',
        method: 'get',
        data: parmas
    });
}

export const Create = (parmas) => {
    //console.log('>>>>>>>>>FreezeMoneyAPICreate',parmas)
    return request({
        url: '/CreditContract/Create',
        method: 'post',
        data: parmas
    })
}

export const DeleteSingle = (parmas) => {
    return request({
        url: '/CreditContract/DeleteSingle',
        method: 'delete',
        data: { "Id": parmas }
    })
}

export const DeleteList = (parmas) => {
    return request({
        url: '/CreditContract/DeleteList',
        method: 'patch',
        data: JSON.stringify(parmas)
    })
}

//{ entity: this.CreditContract, Id: this.CreditContract.Id}
export const Update = (parmas) => {
    return request({
        url: '/CreditContract/Update',
        method: 'put',
        data: { "entity": parmas,"Id": parmas.Id}
    })
}


export const QueryBankInfo = (parmas) => {
    return request({
        url: '/Bank/QueryCashFlowBank',
        method: 'get',
        data: { "BankNameOrBankTail": parmas }
    })
}

export const QueryProjectInfo = (parmas) => {
    return request({
        url: '/Project/QueryCashFlowProject',
        method: 'get',
        data: { "ProjectNameOrProjectTail": parmas }
    })
}

//通过银行ID查询银行
export const QueryBankById = (parmas) => {
    return request({
        url: '/Bank/Get',
        method: 'get',
        data: { "Id": parmas }
    })
}

//通过项目ID查询项目
export const QueryProjectById = (parmas) => {
    return request({
        url: '/Project/Get',
        method: 'get',
        data: { "Id": parmas }
    })
}

//加载银行类型
export const LoadBankType = () => {
    return request({
        url: '/BankType/EntityList',
        method: 'get'
    });
}

//加载工程类型
export const LoadProjectType = () => {
    return request({
        url: '/ProjectType/EntityList',
        method: 'get'
    });
}

//加载款项类型
export const LoadFundsType = () => {
    return request({
        url: '/FundsType/EntityList',
        method: 'get'
    });
}

//加载人员信息（不安全需要改进）
export const LoadOperators = () => {
    return request({
        url: '/User/EntityList',
        method: 'get'
    });
}

//加载公司
export const LoadCompany = () => {
    return request({
        url: '/Company/EntityList',
        method: 'get'
    });
}

//通过Code查询行政区划
export const QueryAdministrativeByCode = (parmas) => {
    return request({
        url: '/Administrative/QueryByCode',
        method: 'get',
        data: {"AdministrativeCode": parmas}
    });
} 

//通过Code查询公司
export const QueryCompanyByCode = (parmas) => {
    return request({
        url: '/Company/QueryByCode',
        method: 'get',
        data: {"CompanyCode": parmas}
    });
} 

//通过Code查询工程项目类型
export const QueryProjectTypeByCode = (parmas) => {
    return request({
        url: '/Company/QueryByCode',
        method: 'get',
        data: {"CompanyCode": parmas}
    });
}

//计算冻结天数
export const ComputeFreezeDayCount = (parmas) => {
    return request({
        url: '/FreezeMoney/ComputeFreezeDayCount',
        method: 'get',
        data: parmas
    })
}

//计算冻结利息
export const ComputeInterest = (parmas) => {
    return request({
        url: '/FreezeMoney/ComputeInterest',
        method: 'get',
        data: parmas
    })
}

//身份号码校验
export const CheckIDNumber = (parmas) => {
    return request({
        url: '/FreezeMoney/CheckIDNumber',
        method: 'get',
        data: parmas
    })
}

//创建word版借条
export const CreateCreditContract = (parmas) => {
    return request({
        url: '/FreezeMoney/CreateWordContract',
        method: 'get',
        data: parmas
    })
}

//删除上传文件
export const DeleteUploadFile = (parmas) => {
    return request({
        url: '/FreezeMoney/DeleteUploadFile',
        method: 'delete',
        data: {"UploadFile": parmas}
    })
}

